package cc.cix.gt.org.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author cix
 */
@Data
@TableName("t_user")
@ApiModel(value = "User对象", description = "用户")
public class User implements Serializable {

    private static long serialVersionUID = -4352868070794165001L;

    /**
     * 默认头像
     */
    public static String DEFAULT_AVATAR = "default.jpg";
    /**
     * 默认密码
     */
    public static String DEFAULT_PASSWORD = "1234qwer";

    @TableId(type = IdType.AUTO)
    @ApiModelProperty("用户 ID")
    private Long id;

    @TableField(condition = SqlCondition.LIKE)
    @ApiModelProperty("用户名")
    private String username;

    @ApiModelProperty("密码")
    private String password;

    @ApiModelProperty("部门 ID")
    private Long deptId;

    @TableField(condition = SqlCondition.LIKE)
    @ApiModelProperty("邮箱")
    private String email;

    @TableField(condition = SqlCondition.LIKE)
    @ApiModelProperty("联系电话")
    private String mobile;

    @ApiModelProperty("状态：0=锁定，1=有效")
    private String status;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty("修改时间")
    private LocalDateTime updateTime;

    @ApiModelProperty("最近访问时间")
    private LocalDateTime lastLoginTime;

    @ApiModelProperty("性别：0=男，1=女，2=保密")
    private String sex;

    @ApiModelProperty("头像")
    private String avatar;

    @TableField(condition = SqlCondition.LIKE)
    @ApiModelProperty("描述")
    private String description;

    @TableField(exist = false)
    @ApiModelProperty("部门名称")
    private String deptName;

    @TableField(exist = false)
    @ApiModelProperty("部门 ID 列表（用于数据权限）")
    private List<Long> deptIds;

    @TableField(exist = false)
    @ApiModelProperty("角色 ID 列表")
    private List<Long> roleIds;

    @TableField(exist = false)
    @ApiModelProperty("角色名")
    private String roleName;

}
